package SuShuThread;

public class FindSuShu implements Runnable {
    private int prime;
    private int q;
    private int w;

    public FindSuShu(int q, int w) {
        this.q = q;
        this.w = w;
    }

    @Override
    public void run() {
        getFindNum(q, w);
    }

    public synchronized void getFindNum(int min, int max) {
        int k = max;
        int j = min;
        if (max < min) {
            System.out.println("maxno<min");
        } else if (max <= 0 || min < 0) {
            System.out.println("no!=0");
        }
        for (int i = k; i > j; i--) {
            if (i == 1) {//1不是素数
                continue;
            }
            prime = i % 2;//去偶
            if (prime == 0 && i > 3) {
                continue;
            }
            prime = i % 3;
            if (prime == 0 && i > 7) {
                continue;
            }
            prime = i % 5;
            if (prime == 0 && i > 7) {
                continue;
            }
            prime = i % 7;
            if (prime == 0 && i > 7) {
                continue;
            }
            System.out.println(Thread.currentThread().getName() + "素数" + i);
        }
    }
}
